/*
 * @lc app=leetcode.cn id=26 lang=javascript
 *
 * [26] 删除排序数组中的重复项
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @return {number}
 */
var removeDuplicates = function(nums) {
    if(nums.length===1){
        return 1;
    }
    let slowindex = 0;
    for(let fastindex = 1; fastindex < nums.length; fastindex++){
        if(nums[slowindex]!==nums[fastindex]){
            nums[++slowindex] = nums[fastindex];
        } 
    }
    return slowindex+1;
};
// @lc code=end

